package com.acme;

import com.acme.bankapp.domain.Bank;
import com.acme.bankapp.domain.Client;
import com.acme.bankapp.domain.Gender;
import com.acme.bankapp.domain.accounts.Account;
import com.acme.bankapp.domain.accounts.CheckingAccount;
import com.acme.bankapp.domain.accounts.SavingAccount;
import com.acme.bankapp.service.BankService;

import java.io.IOException;

/**
 * Created by Student on 19.11.2014.
 */
//Creates file bank.ser and fills it with simple data
public class SerializedBankGenerator {
    public static void main(String[] args) throws IOException {
        Bank bank = new Bank();

        Account tmpAccount = new CheckingAccount(100, 0);
        Client tmpClient = new Client("Human #1", Gender.MALE, tmpAccount);
        BankService.addClient(bank, tmpClient);

        tmpAccount = new SavingAccount(300);
        tmpClient = new Client("Human #2", Gender.FEMALE, tmpAccount);
        BankService.addClient(bank, tmpClient);

        tmpAccount = new CheckingAccount(250, 100);
        tmpClient = new Client("Human #3", Gender.MALE, tmpAccount);
        BankService.addClient(bank, tmpClient);

        BankService.saveBank(bank, "bank.ser");
    }
}
